<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
	<title>Vue列表过渡动画效果</title>
	<script type="text/javascript" src="./vue.js"></script>
</head>
<style type="text/css">
	.v-enter,.v-leave-to {
		opacity: 0;
	}
	.v-enter-active,.v-leave-active {
		transition: 1s;
	}
</style>
<body>	
	<div id="app">
		<!-- 在列表元素周围添加transition-group标签，效果和transition一样 -->
		<transition-group>
			<div v-for="item of list" :key="item.id">{{item.title}}</div>
		</transition-group>
		<button @click="handleAdd">Add</button>
	</div>
	<script>
		var count = 0;
		var app = new Vue({
			el : '#app' ,
			data : {
				list : []
			},
			methods : {
				handleAdd : function() {
					this.list.push({
						title : 'hello world',
						id : count ++
					});
				}
			}
		});
	</script>
</body>
</html>